﻿
/*
 * Create table UDS_MailBody
 */
IF ( OBJECT_ID(N'dbo.UDS_MailBody', N'U') IS NULL )
BEGIN
    CREATE TABLE dbo.UDS_MailBody
    (
        MailBodyID      int             NOT NULL IDENTITY(1,1),
        Creator         nvarchar(50)    COLLATE Chinese_PRC_CI_AS NOT NULL,
        TimeCreated     datetime        NOT NULL CONSTRAINT [DF_UDS_MailBody_TimeCreated] DEFAULT(getdate()),
        ToList          nvarchar(1024)  COLLATE Chinese_PRC_CI_AS NOT NULL,
        CCList          nvarchar(1024)  COLLATE Chinese_PRC_CI_AS NULL,
        BCCList         nvarchar(1024)  COLLATE Chinese_PRC_CI_AS NULL,
        Subject         nvarchar(256)   COLLATE Chinese_PRC_CI_AS NULL,
        Body            nvarchar(max)   COLLATE Chinese_PRC_CI_AS NULL,
        Importance      int             NOT NULL,
        ExternalMail    bit             NOT NULL CONSTRAINT [DF_UDS_MailBody_InternalMail] DEFAULT(0),
        [ClassID]       int             NOT NULL,

        CONSTRAINT [PK_UDS_MailBody] PRIMARY KEY NONCLUSTERED ( [MailBodyID] asc )
    );

    CREATE CLUSTERED INDEX [IX_UDS_MailBody_Creator] ON dbo.UDS_MailBody (Creator asc);
END
GO
